#!/bin/sh
verbose='false'

while getopts "vh" OPTION
do
  case $OPTION in
	  v)
	  verbose='true'
	  ;;
		h)
    echo 'usage: '$0' [-v]'
		exit 0
		;;
		*)
		# unrecognized args, quit
		exit 0
		;;
  esac
done
# Reset $@
#shift `echo $OPTIND-1 | bc`

cat <<EOF
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Proxies unit tests</title>
	<meta name="generator" content="genhtmltests">
</head>
<script>
print = function(res) {
  var txt = document.createTextNode(res);
  var div = document.createElement("div");
  div.appendChild(txt);
  document.getElementById('report').appendChild(div); 
}
</script>
EOF

echo '<script src="consolerunner.js"></script>'
for file in `find TestCases -name '*.js'`
do
  echo '<script src="'$file'"></script>'
done

echo '<body>'
echo  '<button onclick="ES5Harness.startTesting('$verbose')">Start tests</button>'
cat <<EOF
  <div id="report"></div>
</body>
</html>
EOF